import { NBT } from "prismarine-nbt";
import { FloatRange, GameMode, IntRange, Team } from "./arguments";
import { Float, Integer } from "./basic";

export enum SelectorTarget {
    AllEntities = "e",
    TheNearestEntity = "n",

    AllPlayers = "a",
    ARandomPlayer = "r",
    TheNearestPlayer = "p",
    MyPlayer = "s",
}

export type _TargetSelector = {
    type: "_target_selector";
    value: {
        target: SelectorTarget;
        x?: number;
        y?: number;
        z?: number;
        dx?: number;
        dy?: number;
        dz?: number;
        distance?: Range | number;
        limit?: number;
        sort?: string;
        scores?: Record<string, Float | FloatRange>;
        tags: _Selector_Tag[];
        team?: _Selector_Team;
        name?: _Selector_Name;
        type?: _Selector_EntityType;
        predicates: _Selector_Predicate[];
        x_rotation?: Float | FloatRange;
        y_rotation?: Float | FloatRange;
        level?: Integer | IntRange;
        gamemode?: GameMode;
        nbt: NBT;
        advancements: Record<string, string | Record<string, string>>;
        
    };
};

export type _Selector_Tag = {
    type: "_selector_tag";
    value: {
        exclude: boolean;
        value: string;
    };
};

export type _Selector_Team = {
    type: "_selector_team";
    value: {
        exclude: boolean;
        team: Team;
    };
};

export type _Selector_Name = {
    type: "_selector_name";
    value: {
        exclude: boolean;
        name: String;
    };
};

export type _Selector_EntityType = {
    type: "_selector_entity_type";
    value: {
        exclude: boolean;
        name: String;
    };
};

export type _Selector_Predicate = {
    type: "_selector_predicate";
    value: {
        exclude: boolean;
        name: String;
    };
};